<?php include_once __DIR__.'/../inc/userhead.html';?>
<?php include_once __DIR__.'/../inc/usermenu.html';?>
    <!--右面板-->
    <div class="main_panel">
        <!--头部-->
        <div class="panel_head">
            <ul class="title">
                <li><a href="javascript:;">基本资料</a></li>
            </ul>
        </div>
        <!--头部-->
        <div style="height:25px"></div>
        <!--内容-->
        <div class="panel_form clearAfter">
            <div class="userDate">
				<em title="点击切换头像" onclick="document.userHeadForm.userHeadUpload.click();">
					<img src="<?php if($userinfo['pic']){echo $userinfo['pic'];}else{ echo "/static/www/img/eIQ24709560oo.jpg";}?>">
				</em>
				<ins class="inT ins">你好：<?=isset($userinfo['username'])?$userinfo['username']:'未设置';?></ins>
				<ins class="inT">余额：<u style="font-weight:bold">￥<?=$userinfo['money'];?></u></ins>
				<ins><a href="javascript:;" class='agent_btns'>在线充值</a><!--<a href="javascript:;" class='agent_btns'>申请提现</a>--></ins>
			</div>
            <!-- <div class="userDate usLog_Share">
                <h5>我的分享码：88141973</h5>
                <div class="link">
                    <label>专属分享注册地址：</label>
                </div>
                <div class="link" title="复制分享地址">http://www.yumukeji.com/project/mall/user/usRegister.php?shareCode=88141973</div>
            </div> -->
        </div>
        <!--内容-->
        <div style="height:25px"></div>
        <!--内容-->
        <div class="panel_form clearAfter">
            <form name="UserForm" class="layui-form">
                <div class="panel_cut">
                    <p class="inl">
                    	<span>手机号码</span>
                        <ins style='line-height:35px' class='keyRed'><?=$userinfo['phone'];?></ins>
                    </p>
                    <p class="inl">
                    	<span>您的性别</span>
                        &nbsp;&nbsp;<label><input lay-ignore name='sex' <?php if($userinfo['sex'] == 1):?> checked <?php endif;?> type='radio' value='男' >&nbsp;男</label>
						&nbsp;&nbsp;<label><input lay-ignore name='sex' <?php if($userinfo['sex'] == 0):?> checked <?php endif;?> type='radio' value='女' >&nbsp;女</label>
					</p>
                    <p class="inl">
                    	<span>您的昵称</span>
                        <input name="username" required lay-verify="required" type="text" placeholder="请输入您的昵称" value="<?=$userinfo['username'];?>" >
                    </p>
                    <p class="inl">
                    	<span>真实姓名</span>
                        <input name="name"  required lay-verify="required" type="text" placeholder="请输入真实姓名" value="<?=$userinfo['name'];?>">
                    </p>
                    <p class="inl">
                    	<span>开户行名称：</span>
                        <input name="bankname" type="text" value="<?=isset($userbank['bank_name'])?$userbank['bank_name']:'';?>">
                    </p>
                    <p class="inl">
                    	<span>银行用户名：</span>
                        <input name="bankuser" type="text" value="<?=isset($userbank['bank_wangdian'])?$userbank['bank_wangdian']:'';?>">
                    </p>
                    <p class="inl">
                    	<span>银行卡号：</span>
                        <input name="banknumber" type="text" value="<?=isset($userbank['bank_no'])?$userbank['bank_no']:'';?>">
                    </p>
                </div>
                <p class="inl addMarg clear">
					<input type="button"  lay-filter="myform" class="save_btn btn_new_color" lay-submit value="提交保存">
				</p>
            </form>
        </div>
    </div>
    <!--右面板-->
</div>
<!--w1200-->
<!--充值与出金弹出层开始-->
<div class="user-agent" style="display:none">
    <div class="Transparent_layer"></div>
    <div class="user-agent-block">
        <div class="user-agent-head"><a href="javascript:;" class="cur-btn">在线充值</a></div>
        <div class="user-agnet-cont switch-tab">
            <form name="PayForm" method="post" action="/user/recharge">
                <input name="money" type="text" placeholder="请输入充值金额(单位：人民币元)">
				<!-- <input name="paytype" type="radio" value="0" checked><img style="width:20px;height:20px" src='/static/www/img/wx_icon.jpg'/>&nbsp;&nbsp; -->
				<input name="paytype" type="radio" value="2" checked><img style="width:20px;height:20px" src='/static/www/img/zf_icon.jpg'/>
            </form>
            <div class="user-agent-btn"> <a href="javascript:Recharge();" class="confirms">立即充值</a> <a href="javascript:;" class="cancels">取消充值</a> </div>
        </div>
        <span class="agent-close" title="关闭窗口"></span> </div>
</div>
<div id="pay" class="hide"></div>
<!--充值与出金弹出层结束-->
<script>
$(function() {
	//在线充值和提现申请切换效果
	var root = $('.user-agent-block');
	var agent = $('.user-agent');
	var tab = $('.switch-tab');
	var btn = root.find('.user-agent-head').children();
	var blok = $('.user-agent-block');
	btn.eq(0).click(function() {
		$(this).addClass('cur-btn').siblings('a').removeClass();
		tab.eq(0).show().siblings('.switch-tab').hide();
		blok.css({
			height: 230
		});
	});
	btn.eq(1).click(function() {
		$(this).addClass('cur-btn').siblings('a').removeClass();
		tab.eq(1).show().siblings('.switch-tab').hide();
		blok.css({
			height: 308
		});
	});
	$('.agent-close,.cancels').click(function() {
		agent.hide();
	});
	$('.agent_btns').click(function() {
		agent.show();
	});
	$('.agent_btns').eq(1).click(function() {
		btn.eq(1).addClass('cur-btn').siblings('a').removeClass();
		tab.eq(1).show().siblings('.switch-tab').hide();
		blok.css({
			height: 308
		});
	});
	$('.agent_btns').eq(0).click(function() {
		btn.eq(0).addClass('cur-btn').siblings('a').removeClass();
		tab.eq(0).show().siblings('.switch-tab').hide();
		blok.css({
			height: 230
		});
	});
});
//客户充值提交函数
function Recharge() {
	var money = document.PayForm.money.value
    var paytype = document.PayForm.paytype.value;
	if (money == "") {
		layer.msg("请填写需要充值的人民币金额");
		return false;
	} else if (! ( /^[0-9]+(.[0-9]{1,2})?$/.test(money))) {
		layer.msg("金额格式不正确");
		return false;
	} else {
        $.ajax({
            url:"/user/recharge",
            method:"post",
            dataType:"json",
            data:{paytype:paytype,money:money},
            success:function(res){
                console.log(res);
                if(res.code == 0){
                    $("#pay").html(res.data.formhtml);
                }else{
                    layer.msg(res.msg);
                }

            }
        });
	}
}
//用户申请提现
function Withdrawals(){
	var bankname = document.usDrawForm.bankname.value;
	var bankuser = document.usDrawForm.bankuser.value;
	var banknumber = document.usDrawForm.banknumber.value;
	var money = document.usDrawForm.money.value;
	if(!bankname){
		layer.msg("请填写开户行名称");
		return false;
	}
	if(!bankuser){
		layer.msg("请填写开户人姓名");
		return false;
	}
	if(!banknumber){
		layer.msg("请填写卡号");
		return false;
	}
	if (money == "") {
		layer.msg("请填写需要提现的金额");
		return false;
	} else if (! ( /^[0-9]+(.[0-9]{1,2})?$/.test(money))) {
		layer.msg("金额格式不正确");
		return false;
	} else {
		document.PayForm.submit();
	}
}
</script>
<?php include_once __DIR__.'/../inc/foot.html';?>
